
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _DETALLEMOV_PRODUCTOS
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "DETALLEMOV_PRODUCTOS"
			Me.MappingName = "DETALLEMOV_PRODUCTOS"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_DETALLEMOV_PRODUCTOSLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal CodMovPedidoDetalle As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_DETALLEMOV_PRODUCTOS.Parameters.CodMovPedidoDetalle, CodMovPedidoDetalle)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_DETALLEMOV_PRODUCTOSLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property CodMovPedidoDetalle As SqlParameter
                Get
                    Return New SqlParameter("@CodMovPedidoDetalle", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodMovPedido As SqlParameter
                Get
                    Return New SqlParameter("@CodMovPedido", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodProducto As SqlParameter
                Get
                    Return New SqlParameter("@CodProducto", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Cantidad As SqlParameter
                Get
                    Return New SqlParameter("@Cantidad", SqlDbType.Int, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const CodMovPedidoDetalle As String = "codMovPedidoDetalle"
            Public Const CodMovPedido As String = "codMovPedido"
            Public Const CodProducto As String = "codProducto"
            Public Const Cantidad As String = "cantidad"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodMovPedidoDetalle) = _DETALLEMOV_PRODUCTOS.PropertyNames.CodMovPedidoDetalle
                    ht(CodMovPedido) = _DETALLEMOV_PRODUCTOS.PropertyNames.CodMovPedido
                    ht(CodProducto) = _DETALLEMOV_PRODUCTOS.PropertyNames.CodProducto
                    ht(Cantidad) = _DETALLEMOV_PRODUCTOS.PropertyNames.Cantidad

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const CodMovPedidoDetalle As String = "CodMovPedidoDetalle"
            Public Const CodMovPedido As String = "CodMovPedido"
            Public Const CodProducto As String = "CodProducto"
            Public Const Cantidad As String = "Cantidad"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodMovPedidoDetalle) = _DETALLEMOV_PRODUCTOS.ColumnNames.CodMovPedidoDetalle
                    ht(CodMovPedido) = _DETALLEMOV_PRODUCTOS.ColumnNames.CodMovPedido
                    ht(CodProducto) = _DETALLEMOV_PRODUCTOS.ColumnNames.CodProducto
                    ht(Cantidad) = _DETALLEMOV_PRODUCTOS.ColumnNames.Cantidad

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const CodMovPedidoDetalle As String = "s_CodMovPedidoDetalle"
            Public Const CodMovPedido As String = "s_CodMovPedido"
            Public Const CodProducto As String = "s_CodProducto"
            Public Const Cantidad As String = "s_Cantidad"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property CodMovPedidoDetalle As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodMovPedidoDetalle)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodMovPedidoDetalle, Value)
            End Set
        End Property

        Public Overridable Property CodMovPedido As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodMovPedido)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodMovPedido, Value)
            End Set
        End Property

        Public Overridable Property CodProducto As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodProducto)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodProducto, Value)
            End Set
        End Property

        Public Overridable Property Cantidad As Integer
            Get
                Return MyBase.Getint(ColumnNames.Cantidad)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.Cantidad, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_CodMovPedidoDetalle As String
			Get
				If Me.IsColumnNull(ColumnNames.CodMovPedidoDetalle) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodMovPedidoDetalle)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodMovPedidoDetalle)
				Else
					Me.CodMovPedidoDetalle = MyBase.SetintAsString(ColumnNames.CodMovPedidoDetalle, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodMovPedido As String
			Get
				If Me.IsColumnNull(ColumnNames.CodMovPedido) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodMovPedido)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodMovPedido)
				Else
					Me.CodMovPedido = MyBase.SetintAsString(ColumnNames.CodMovPedido, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodProducto As String
			Get
				If Me.IsColumnNull(ColumnNames.CodProducto) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodProducto)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodProducto)
				Else
					Me.CodProducto = MyBase.SetintAsString(ColumnNames.CodProducto, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Cantidad As String
			Get
				If Me.IsColumnNull(ColumnNames.Cantidad) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.Cantidad)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Cantidad)
				Else
					Me.Cantidad = MyBase.SetintAsString(ColumnNames.Cantidad, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property CodMovPedidoDetalle() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.CodMovPedidoDetalle, Parameters.CodMovPedidoDetalle)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodMovPedido() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodMovPedido, Parameters.CodMovPedido)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodProducto() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodProducto, Parameters.CodProducto)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Cantidad() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Cantidad, Parameters.Cantidad)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property CodMovPedidoDetalle() As WhereParameter 
			Get
				If _CodMovPedidoDetalle_W Is Nothing Then
					_CodMovPedidoDetalle_W = TearOff.CodMovPedidoDetalle
				End If
				Return _CodMovPedidoDetalle_W
			End Get
		End Property

		Public ReadOnly Property CodMovPedido() As WhereParameter 
			Get
				If _CodMovPedido_W Is Nothing Then
					_CodMovPedido_W = TearOff.CodMovPedido
				End If
				Return _CodMovPedido_W
			End Get
		End Property

		Public ReadOnly Property CodProducto() As WhereParameter 
			Get
				If _CodProducto_W Is Nothing Then
					_CodProducto_W = TearOff.CodProducto
				End If
				Return _CodProducto_W
			End Get
		End Property

		Public ReadOnly Property Cantidad() As WhereParameter 
			Get
				If _Cantidad_W Is Nothing Then
					_Cantidad_W = TearOff.Cantidad
				End If
				Return _Cantidad_W
			End Get
		End Property

		Private _CodMovPedidoDetalle_W As WhereParameter = Nothing
		Private _CodMovPedido_W As WhereParameter = Nothing
		Private _CodProducto_W As WhereParameter = Nothing
		Private _Cantidad_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_CodMovPedidoDetalle_W = Nothing
			_CodMovPedido_W = Nothing
			_CodProducto_W = Nothing
			_Cantidad_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property CodMovPedidoDetalle() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodMovPedidoDetalle, Parameters.CodMovPedidoDetalle)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodMovPedido() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodMovPedido, Parameters.CodMovPedido)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodProducto() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodProducto, Parameters.CodProducto)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Cantidad() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Cantidad, Parameters.Cantidad)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property CodMovPedidoDetalle() As AggregateParameter 
			Get
				If _CodMovPedidoDetalle_W Is Nothing Then
					_CodMovPedidoDetalle_W = TearOff.CodMovPedidoDetalle
				End If
				Return _CodMovPedidoDetalle_W
			End Get
		End Property

		Public ReadOnly Property CodMovPedido() As AggregateParameter 
			Get
				If _CodMovPedido_W Is Nothing Then
					_CodMovPedido_W = TearOff.CodMovPedido
				End If
				Return _CodMovPedido_W
			End Get
		End Property

		Public ReadOnly Property CodProducto() As AggregateParameter 
			Get
				If _CodProducto_W Is Nothing Then
					_CodProducto_W = TearOff.CodProducto
				End If
				Return _CodProducto_W
			End Get
		End Property

		Public ReadOnly Property Cantidad() As AggregateParameter 
			Get
				If _Cantidad_W Is Nothing Then
					_Cantidad_W = TearOff.Cantidad
				End If
				Return _Cantidad_W
			End Get
		End Property

		Private _CodMovPedidoDetalle_W As AggregateParameter = Nothing
		Private _CodMovPedido_W As AggregateParameter = Nothing
		Private _CodProducto_W As AggregateParameter = Nothing
		Private _Cantidad_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_CodMovPedidoDetalle_W = Nothing
		_CodMovPedido_W = Nothing
		_CodProducto_W = Nothing
		_Cantidad_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_DETALLEMOV_PRODUCTOSInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.CodMovPedidoDetalle.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_DETALLEMOV_PRODUCTOSUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_DETALLEMOV_PRODUCTOSDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodMovPedidoDetalle)
		p.SourceColumn = ColumnNames.CodMovPedidoDetalle
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodMovPedidoDetalle)
		p.SourceColumn = ColumnNames.CodMovPedidoDetalle
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodMovPedido)
		p.SourceColumn = ColumnNames.CodMovPedido
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodProducto)
		p.SourceColumn = ColumnNames.CodProducto
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Cantidad)
		p.SourceColumn = ColumnNames.Cantidad
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

